#include <stdio.h>

void reverse(int *a, int len) {
	int i = 0, j = len - 1, temp = 0, m, k;
	while (i < j) {
		if ((*(a + i) % 2 != 0) && (*(a + j) % 2 == 0)) {
			temp = *(a + i);
			*(a + i) = *(a + j);
			*(a + j) = temp;
		}
		if (*(a + i) % 2 == 0)
			i++;
		if (*(a + j) % 2 != 0)
			j--;
	}
	for (i = 0, j = 0; i < len; i++)
		if (*(a + i) % 2 == 0)
			j++;
		else
			break;
	k = len - j;
	for (m = 0; m < j - 1; m++)
		for (i = 0; i < j - 1 - m; i++)
			if (a[i] < a[i + 1]) {
				temp = a[i];
				a[i] = a[i + 1];
				a[i + 1] = temp;
			}
	for (m = 0; m < k - 1; m++)
		for (i = j; i < len - 1 - m; i++)
			if (a[i] > a[i + 1]) {
				temp = a[i];
				a[i] = a[i + 1];
				a[i + 1] = temp;
			}
}

void main() {
	int a[10], i;
	for (i = 0; i < 10; i++)
		scanf("%d", &a[i]);
	reverse(a, 10);
	for (i = 0; i < 10; i++)
		printf("%d ", a[i]);
	printf("\n");
}
